#include <stdio.h>
#include <stdlib.h>
#include <math.h>
#include <string.h>
#include <ctype.h>
#include <time.h>
#include <unistd.h>
#include <fcntl.h>
#include "errsys.h"

double jsqrt(double v)
{
	double l=0.0, h=v;
	double d,m, mini = 0.000001;

	for(;;){
		m = (l+h)/2;
		d = m*m-v;

		if(d>mini)
			h=m;
		else if(d<-mini)
			l=m;
		else 
			return m;
	}
}

int is_primer(unsigned long v)
{
	if(v==1)
		return 0;
	if(v==2)
		return 1;

	int sqrt = (int)jsqrt((double)v)+1;
	int i;

	for(i=2;i<=sqrt;++i)
		if(v%i == 0)
			return 0;

	return 1;
}

int main(int argc, char **argv)
{
	if(argc==1){
		printf("Usage:%s interger\n",argv[0]);
		exit(1);
	}

	int i = atoi(argv[1]);
	if(i<6 || is_primer(i) ){
		printf("primer or less than 6\n");
		exit(1);
	}

	int j=2;
	for(;j<=jsqrt(i)+1;++j){
		if( is_primer(j) && is_primer(i-j) )
			printf("%10d\t%10d\n",j,i-j);
	}

	return 0;
}

